class Solution {
public:
    int maxArea(vector<int>& height) {
        int left = 0, right = height.size() - 1, ret = 0;
        while(left < right) // 如果短的板不动的话，取到的水永远不会比上次多
        {
            if(height[left] < height[right])
            {
                ret = max(ret, height[left] * (right - left));
                ++left;
            }
            else
            {
                ret = max(ret, height[right] * (right - left));
                --right;
            }
        }
        return ret;
    }
};